package com.cheifsteam.springframework.aop;


import org.aopalliance.intercept.MethodInterceptor;

/**
 * 代理配置支持类，封装了AOP代理所需的核心配置信息
 *
 * @author qrx
 * @date 2025/8/5 9:42
 * @description: 切面配置支持类，用于存储和管理代理相关的配置信息
 */
public class AdvisedSupport {

    // ProxyConfig
    private boolean proxyTargetClass = false;
    // 被代理的目标对象封装（通过TargetSource可以提供更灵活的目标对象访问方式）
    private TargetSource targetSource;

    // 方法拦截器，用于实现环绕通知等AOP功能
    private MethodInterceptor methodInterceptor;

    // 方法匹配器，用于确定哪些方法需要被拦截
    private MethodMatcher methodMatcher;

    /**
     * 获取目标对象封装
     * @return 当前配置的TargetSource对象
     */
    public TargetSource getTargetSource() {
        return targetSource;
    }

    /**
     * 设置目标对象封装
     * @param targetSource 要设置的TargetSource对象
     */
    public void setTargetSource(TargetSource targetSource) {
        this.targetSource = targetSource;
    }

    /**
     * 获取方法拦截器
     * @return 当前配置的MethodInterceptor对象
     */
    public MethodInterceptor getMethodInterceptor() {
        return methodInterceptor;
    }

    /**
     * 设置方法拦截器
     * @param methodInterceptor 要设置的MethodInterceptor对象
     */
    public void setMethodInterceptor(MethodInterceptor methodInterceptor) {
        this.methodInterceptor = methodInterceptor;
    }

    /**
     * 获取方法匹配器
     * @return 当前配置的MethodMatcher对象
     */
    public MethodMatcher getMethodMatcher() {
        return methodMatcher;
    }

    /**
     * 设置方法匹配器
     * @param methodMatcher 要设置的MethodMatcher对象
     */
    public void setMethodMatcher(MethodMatcher methodMatcher) {
        this.methodMatcher = methodMatcher;
    }


    public boolean isProxyTargetClass(){
       return proxyTargetClass;
    }

    public void setProxyTargetClass(boolean proxyTargetClass) {
        this.proxyTargetClass = proxyTargetClass;
    }
}